Chapter 4 - Colors and Color-Related Objects
This chapter describes the QuickDraw GX color architecture and the objects and structures with which you manipulate colors. Read this chapter if your application does any color drawing or calculation, or if you create or modify bitmaps or color sets. Read this chapter also if you are creating a calibration program to generate color profiles.Before reading this chapter, you should be familiar with the information in the chapter "Introduction to QuickDraw GX" in this book. You should also be familiar with shape objects, as discussed in the chapter "Shape Objects" in this book.
This chapter constitutes the complete discussion of color for QuickDraw GX. Unlike for shape objects and style objects, there is no additional discussion of color-related objects in other books. However, additional information relevant to color is in the chapter "Ink Objects" in this book.
QuickDraw GX uses color-matching methods provided by the Macintosh ColorSync Utilities. For information on ColorSync, its color-matching capabilities, and the structure of the color profiles it uses, see the ColorSync chapter of Inside Macintosh: Advanced Color Imaging and the Component Manager chapter of Inside Macintosh: More Macintosh Toolbox.
For general information on color theory and color spaces, you may also want to read other books such as these: Measuring Color, by R.W.G. Hunt, John Wiley & Sons, New York, 1991; Illumination and Color in Computer Generated Imagery, by Roy Hall, Springer-Verlag, New York, 1989; and Computer Graphics: Principles and Practice, by J. Foley, A. van Dam, S. Feiner, and J. Hughes, Addison-Wesley, Reading, 1990.
This chapter introduces how color is represented in QuickDraw GX, and describes color set objects and color profile objects and their properties. It then shows how to use QuickDraw GX functions to
- assign colors to shapes
- compare, test, and convert colors
- automatically use the color-matching capabilities of QuickDraw GX
- create and manipulate color profiles for imaging devices
- manipulate the colors of a bitmap that uses indexed colors
Chapter Contents
- About Color in QuickDraw GX
- Color Spaces
- Luminance-Based Color Spaces
- RGB-Based Color Spaces
- RGB Spaces
- HSV and HLS Color Spaces
- CMYK Color Spaces
- Universal Color Spaces
- XYZ Space
- Yxy Space
- L*u*v* Space and L*a*b* Space
- Formats for XYZ-Based Color Spaces
- Video Color Spaces
- Indexed Color Spaces
- Color Spaces With Alpha Channels
- Color-Component Values, Color Values, and Colors
- Color Conversion and Color Matching
- Color Profiles
- Color-Matching Methods
- When Color Matching Occurs
- About Color Set Objects
- Color Set Properties
- Color Values in a Color Set
- Default Color Sets
- About Color Profile Objects
- Color Profile Properties
- Profile Data
- The Default Color Profile
- Zero-Length Profiles
- Using Colors and Color-Related Objects
- Assigning Colors to Shapes
- Assigning Color Profiles to Colors
- Comparing and Testing Colors
- Checking for Out-of-Gamut Colors
- Checking Colors for Closeness and Color Space
- Predicting Drawing Results
- Converting and Matching Colors
- Creating and Manipulating Color Set and Color Profile Objects
- Creating and Disposing of a Color Set or Color Profile
- Copying, Comparing, and Cloning Color Sets and Color Profiles
- Loading and Unloading Color Sets and Color Profiles
- Manipulating Object Properties of Color Sets and Color Profiles
- Manipulating Owner Counts
- Getting and Setting Tag References
- Manipulating the Colors in a Color Set Object
- Manipulating the Profile Data in a Color Profile Object
- Colors and Color-Related Objects Reference
- Constants and Data Types
- Color-Component Values
- Color Values
- The Color Structure
- Color Packing
- Color Spaces
- The Color Set Object
- The gxSetColor Union
- The Color Profile Object
- Color Functions
- Color Set Functions
- Creating and Manipulating Color Set Objects
- Manipulating Color Set Object Properties
- Retrieving and Replacing Colors in a Color Set
- Color Profile Functions
- Creating and Manipulating Color Profile Objects
- Manipulating Color Profile Object Properties
- Retrieving and Replacing Profile Information
- Summary of Colors and Color-Related Objects
- Constants and Data Types
- Color-Component Values
- Color Values
- The Color Structure
- Color Packing
- Color Spaces
- The Color Set Object
- The gxSetColor Union
- The Color Profile Object
- Color Functions
- Color Set Functions
- Creating and Manipulating Color Set Objects
- Manipulating Color Set Object Properties
- Retrieving and Replacing Colors in a Color Set
- Color Profile Functions
- Creating and Manipulating Color Profile Objects
- Manipulating Color Profile Object Properties
- Retrieving and Replacing Profile Information